package com.quanxiaoha.weblog.common.domain.dos;

import com.quanxiaoha.weblog.common.domain.entity.ScheduleCount;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class CountNode extends ScheduleCount {

    private String name;
    private List<CountNode> children = new ArrayList<>(); // 核心：List存储子节点

    public CountNode(String name) {
        this.name = name;
    }

    // 添加子节点（无需维护父引用）
    public void addChild(CountNode child) {
        children.add(child);
    }

    // 批量添加子节点
    public void addChildren(List<CountNode> children) {
        this.children.addAll(children);
    }

}
